from neo4django.db import models


class User(models.NodeModel):
    #firstname of the user that registered in first time
    firstName = models.StringProperty(max_length=20)

    #lastname of the user that registered in first time
    lastName = models.StringProperty(max_length=20)

    #password of user that selected by user
    password = models.StringProperty(max_length=50)

    #email that use for verification
    email = models.EmailProperty(indexed=True, unique=True)

    #status of the user that can be 1 for online and 0 for offline
    status = models.BooleanProperty()

    #date of birth that user selected from the register form
    #BirthDate = models.DateProperty()

    #sex of the user that can be male and female (0=male,1=female)
    gender = models.BooleanProperty()

    #friendShip==> [ user1 -[friend]-> user2 ]
    friendShip = models.Relationship('User',
                                     rel_type='friend',
                                     related_name='friends')

    #enemyShip==> [ user1 -[enemy]-> user2 ]
    enemyShip = models.Relationship('User',
                                    rel_type='enemy',
                                    related_name='enemies')




class Post(models.NodeModel):
    #content of the post that is created or shared
    text = models.StringProperty()

    #the address of the image that save in the Server hard or external link
    image = models.StringProperty()

    #the address of the video clip saved in the Server hard or external link
    video = models.StringProperty()

    commentPost = models.Relationship('User',
                                      rel_type='comment',
                                      related_name='comments')
    createPost = models.Relationship('User',
                                     rel_type='create',
                                     related_name='createdPosts')

    sharePost = models.Relationship('User',
                                    rel_type='share',
                                    related_name='sharedPosts'
                                    )

    likePost = models.Relationship('User',
                                   rel_type='like',
                                   related_name='likedPosts')

    hatePost = models.Relationship('User',
                                   rel_type='hate',
                                   related_name='hatedPosts')






